<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/webpage/common/taglibs.jspf"%>
<!DOCTYPE html>
<html>
<head>
	<title>修改温度信息</title>
	<meta name="decorator" content="form"/>
</head>

<body class="white-bg">
<table class="table table-bordered  table-condensed dataTables-example dataTable no-footer">
	<tbody>
	<tr>
		<td  class="width-15 active text-right">
			<label>设备编号:</label>
		</td>
		<td class="width-35" >
			<input id="deviceId" htmlEscape="false" class="form-control" value="${deviceId}" readonly="true"/>
		</td>
		<td  class="width-15 active text-right">
			<label>设备序列号:</label>
		</td>
		<td class="width-35" >
			<input id="sn" htmlEscape="false" class="form-control" value="${sn}" readonly="true"/>
		</td>
	<tr>
		<td class="width-15 active text-right">
			<label>采集时间:</label>
		</td>
		<td  class="width-35" >
			<input id="collectTime" htmlEscape="false" class="form-control" value="${collectTime}" readonly="true"/>
		</td>
		<td  class="width-15 active text-right">
			<label>温度值:</label>
		</td>
		<td  class="width-35" >
			<input id="temperature" htmlEscape="false" class="form-control" value="${temperature}"/>
		</td>
		<input id="temperatureBefore" type="hidden" htmlEscape="false" value="${temperature}"/>
	</tr>
	<tr>
		<td class="width-15 active text-right">
			<label>最低温:</label>
		</td>
		<td  class="width-35" >
			<input id="wendMin" htmlEscape="false" class="form-control" value="${wendMin}" readonly="true"/>
		</td>
		<td  class="width-15 active text-right">
			<label>最低温:</label>
		</td>
		<td  class="width-35" >
			<input id="wendMax" htmlEscape="false" class="form-control" value="${wendMax}" readonly="true"/>
		</td>
	</tr>
	</tbody>
</table>
<script>
	$(document).ready(function () {
		$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
			resizeGrid();
		});
	});
	$(function(){
		$(window).resize(function(){
			resizeGrid();
		});
	});

	/* 父页面点击确定时触发的事件 */
	function confirm(callback) {
		var temperature = $("#temperature").val();
		if (isNull(temperature)) {
			top.layer.alert("请输入要修改的温度！", {icon: 0, title:'提示'});
			return;
		}
		var wendMin = $("#wendMin").val();
		var wendMax = $("#wendMax").val();
		if (parseFloat(temperature) < parseFloat(wendMin)
				|| parseFloat(temperature) > parseFloat(wendMax)) {
			top.layer.alert("修改的温度超出商品温度范围！", {icon: 0, title:'提示'});
			return;
		}

		// POST请求配送交接
		$.ajax({
			type: "POST",
			url: "${adminPath}/cc/warning/updateTemp",
			data: {
				deviceId : $("#deviceId").val(),
				sn : $("#sn").val(),
				collectTime : $("#collectTime").val(),
				temperature : temperature,
				temperatureBefore : $("#temperatureBefore").val()
			},
			success: function (data) {
				top.layer.alert(data.msg, {icon: 0, title:'提示'});
				if (data.ret == 0) {
					// 最后调用回调函数，关闭对话框
					if (typeof callback == "function") {
						callback();
					}
				}
			}
		});
	}

</script>
</body>
</html>